{% extends 'layout/basic.html' %}
{% load static %}
{% block title %}登录{% endblock %}
{% block css %}
    <link rel="stylesheet" href="{% static 'css/account.css' %}">
{% endblock %}
{% block content %}
    <form class="account" method="post">
        {% csrf_token %}
        <div class="shell">
            <h2 class="title">Login</h2>
            {% for field in form %}
                <div class="form-group">
                    {% if field.label != '验证码' %}
                        {{ field }}
                        <div class="err-msg">{{ field.errors.0 }}</div>
                    {% else %}
                        <div class="col-md-6">
                            {{ field }}
                            <div class="err-msg">{{ field.errors.0 }}</div>
                        </div>
                        <div class="col-md-6">
                            <img src="{% url 'image_code' %}" title="点击更换图片" alt="" id="imageCode" style="margin-top: 17px">
                        </div>
                    {% endif %}
                </div>
            {% endfor %}
        <div>
            <a href="{% url 'login_sms' %}">短信验证码登录</a>
        </div>
            <input id='btnSubmit' type="submit" value="登 录">
        </div>
    </form>
{% endblock %}
{% block js %}
    <script>
        $('#imageCode').click(function () {
            let oldSrc = $(this).attr('src')
            $(this).attr('src', oldSrc + '?')
        })
    </script>
{% endblock %}
